package PTA.MainXDX.ex05;

import PTA.Mianxiangduixiang.ex42.P;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;
class PersonOverride{
    private String name;
    private int age;
    private boolean gender;

    public PersonOverride(String name, int age, boolean gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    public PersonOverride() {
        this("default",1,true);
    }

    @Override
    public String toString() {
        return name+"-"+age+"-"+gender;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PersonOverride that = (PersonOverride) o;
        return age == that.age && gender == that.gender && Objects.equals(name, that.name);
    }

}
public class ex05 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean f=true;
    int n1 = sc.nextInt();
    sc.nextLine();
        ArrayList<PersonOverride> po = new ArrayList<>();
        for(int i=0;i<n1;i++){
            po.add(new PersonOverride());
        }
  int n2 = sc.nextInt();
        sc.nextLine();
        for(int i=0;i<n2;i++){
            f=true;
            PersonOverride p = new PersonOverride(sc.next(),sc.nextInt(),sc.nextBoolean());
            for(PersonOverride s:po){
                if(s.equals(p)){
                    f=false;
                    break;
                }
            }
            if(f){
                po.add(p);
            }

        }
        for(PersonOverride a:po){
            System.out.println(a.toString());
        }
        System.out.println(po.size()-n1);
        System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));


    }
}
